#!/usr/bin/python
# -*- coding: utf-8 -*-

"""
Author: chenmurong
Module Description: cross_naadam ...
File: cross_naadam.py
Date: 2019/11/11
"""
from pyshare.utils.game_log.game_log_define import CrossNaadamRoleVitLog, CrossNaadamPrestigeLog, \
    CrossNaadamHadaValueLog, CrossNaadamRoleScoreLog


class CrossNaadamRoleMixin(object):

    role_guid = NotImplemented
    vit = NotImplemented
    prestige_value = NotImplemented
    hada_value = NotImplemented
    score = NotImplemented
    vit_use_count = NotImplemented

    def role_vit_log(self, val):
        """
        体力日志
        :param val:
        :return:
        """
        add_vit = val - self.vit.remaining
        if add_vit == 0:
            return
        try:
            if add_vit < 0:
                self.vit_use_count += abs(add_vit)
            CrossNaadamRoleVitLog.log_game(self.role_guid, val, add_vit)
        except:
            pass

    def role_prestige_log(self, val):
        """
        个人声望日志
        :param val:
        :return:
        """
        add_prestige_value = val - self.prestige_value
        if add_prestige_value == 0:
            return
        try:
            CrossNaadamPrestigeLog.log_game(self.role_guid, val, add_prestige_value)
        except:
            pass

    def hada_value_log(self, val):
        """
        个人哈达日志
        :param val: 哈达数值
        :return:
        """
        add_hada_value = val - self.hada_value
        if add_hada_value == 0:
            return
        try:
            CrossNaadamHadaValueLog.log_game(self.role_guid, val, add_hada_value)
        except:
            pass

    def score_value_log(self, val):
        """
        个人积分日志
        :param val: 积分数值
        :return:
        """
        add_score_value = val - self.score
        if add_score_value == 0:
            return
        try:
            CrossNaadamRoleScoreLog.log_game(self.role_guid, val, add_score_value)
        except:
            pass
